﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">

<!-- jsp文件头和头部 -->
<%@ include file="../../system/admin/top.jsp"%>

</head>

<body>


	<div class="container-fluid" id="main-container">



		<div id="page-content" class="clearfix">

			<div class="row-fluid">


				<div class="row-fluid">

					<!-- 检索  -->
					<form action="company/list.do?isM1=${pdm.isM1 }&isM2=${pdm.isM2 }"
						method="post" name="userForm" id="userForm">
						<table border='0'>
							<tr>

								<td><span class="input-icon"> <input
										autocomplete="off" id="nav-search-input" type="text"
										name="companycode" value="${pd.company_code }"
										placeholder="这里输入简码" /> <i id="nav-search-icon"
										class="icon-search"></i>
								</span></td>
								<td><span class="input-icon"> <input
										autocomplete="off" id="nav-search-input" type="text"
										name="companyname" value="${pd.company_name }"
										placeholder="这里输入名称" /> <i id="nav-search-icon"
										class="icon-search"></i>
								</span></td>
								<td><span class="input-icon"> <input
										autocomplete="off" id="nav-search-input" type="text"
										name="companypiny" value="${pd.company_piny }"
										placeholder="这里输入简拼" /> <i id="nav-search-icon"
										class="icon-search"></i>
								</span></td>
								<td style="vertical-align: top;"><button
										class="btn btn-mini btn-light" onclick="search();" title="检索">
										<i id="nav-search-icon" class="icon-search"></i>
									</button></td>
								<td style="vertical-align: top;"><button
										class="btn btn-mini btn-light" onclick="empty();" title="清空">
										<i id="nav-repeat-icon" class="icon-repeat"></i>
									</button></td>
								</td>
							</tr>

						</table>
						<!-- 检索  -->


						<table id="table_report"
							class="table table-striped table-bordered table-hover">

							<thead>
								<tr>
									<th>公司编码</th>
									<th>公司名称</th>
									<th>公司简拼</th>
									<th>公司运营</th>
									<th>公司电话</th>
									<th>公司邮箱</th>
									<th>公司地址</th>
									<th class="center">操作</th>
								</tr>
							</thead>

							<tbody>

								<!-- 开始循环 -->
								<c:choose>
									<c:when test="${not empty varList}">
										<c:if test="${QX.cha == 1 }">
											<c:forEach items="${varList}" var="var" varStatus="vs">

												<tr>
													<td class='center' style="width: 30px;">${var.company_code}</td>
													<td><a
														href="<%=basePath%>/depart/list.do?companyid=${var.id}"
														title="查看下级"><i
															class="icon-arrow-right  icon-on-right"></i>&nbsp;${var.company_name}</td>
													<td>${var.company_piny }</td>
													<td>${var.linkman}</td>
													<td>${var.mobile}</td>
													<td>${var.email}</td>
													<td>${var.address}</td>
													<td style="width: 60px;" class="center">
														<div class='hidden-phone visible-desktop btn-group'>

															<c:if
																test="${QX.edit != 1 && QX.del != 1 && QX.cha != 1 }">
																<span
																	class="label label-large label-grey arrowed-in-right arrowed-in"><i
																	class="icon-lock" title="无权限"></i></span>
															</c:if>
															<c:if test="${QX.cha == 1 }">
																<a class='btn btn-mini btn-light' title="详细"
																	onclick="find('${var.id }');"><i
																	class='icon-tasks'></i></a>
															</c:if>
															<c:if test="${QX.edit == 1 }">
																<a class='btn btn-mini btn-info' title="编辑"
																	onclick="edit('${var.id }');"><i class='icon-edit'></i></a>
															</c:if>
															<c:if test="${QX.del == 1 }">
																<a class='btn btn-mini btn-danger' title="删除"
																	onclick="del('${var.id }');"><i class='icon-trash'></i></a>
															</c:if>

														</div>
													</td>
												</tr>

											</c:forEach>
										</c:if>

										<c:if test="${QX.cha == 0 }">
											<tr>
												<td colspan="100" class="center">您无权查看</td>
											</tr>
										</c:if>
									</c:when>
									<c:otherwise>
										<tr class="main_info">
											<td colspan="100" class="center">没有相关数据</td>
										</tr>
									</c:otherwise>
								</c:choose>


							</tbody>
						</table>

						<div class="page-header position-relative">
							<table style="width: 100%;">
								<tr>
									<c:if test="${QX.add == 1 }">
										<td style="vertical-align: top;" width="80px;"><a
											class="btn btn-small btn-success" onclick="add();">新增<i
												class="icon-pencil"></i></a></td>
									</c:if>
									<c:if test="${QX.cha == 1 }">
										<td style="vertical-align: top; width: 80px;" class="left"><a
											class="btn btn-small btn-info"
											onclick="window.location.href=window.location.href;">刷新<i
												class="icon-refresh"></i></a></td>
									</c:if>
									<td style="vertical-align: top;"><div class="pagination"
											style="float: right; padding-top: 0px; margin-top: 0px;">${page.pageStr}</div></td>
								</tr>
							</table>
						</div>
					</form>
				</div>




				<!-- PAGE CONTENT ENDS HERE -->
			</div>
			<!--/row-->

		</div>
		<!--/#page-content-->
	</div>
	<!--/.fluid-container#main-container-->

	<!-- 返回顶部  -->
	<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse"> <i
		class="icon-double-angle-up icon-only"></i>
	</a>

	<!-- 引入 -->
	<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/ace-elements.min.js"></script>
	<script src="static/js/ace.min.js"></script>

	<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script>
	<!-- 单选框 -->
	<script type="text/javascript"
		src="static/js/bootstrap-datepicker.min.js"></script>
	<!-- 日期框 -->
	<script type="text/javascript" src="static/js/bootbox.min.js"></script>
	<!-- 确认窗口 -->
	<!-- 引入 -->

	<script type="text/javascript">
		
		$(top.hangge());
		
		//检索
		function search(){
			$("#Form").submit();
		}
		
		//新增
		function add(){
			top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="新增";
			 diag.URL = '<%=basePath%>company/goAdd.do';
			 diag.Width = 800;
			 diag.Height = 600;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
					 if('${page.currentPage}' == '0'){
						 top.jzts();
						 setTimeout("self.location.reload()",100);
					 }else{
						 nextPage(${page.currentPage});
					 }
				}
				diag.close();
			 };
			 diag.show();
		}
		
		//修改
		function edit(id){
			top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="编辑";
			 diag.URL = '<%=basePath%>company/goEdit.do?id='+id;
			 diag.Width = 800;
			 diag.Height = 600;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
					 nextPage(${page.currentPage});
				}
				diag.close();
			 };
			 diag.show();
		}
		
		//查看详细
		function find(id){
			top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="详细";
			 diag.URL = '<%=basePath%>company/goFind.do?id='+id;
			 diag.Width = 800;
			 diag.Height = 600;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
					 nextPage(${page.currentPage});
				}
				diag.close();
			 };
			 diag.show();
		}
		
		//删除
		function del(id){
			bootbox.confirm("确定要删除该记录?", function(result) {
				if(result) {
					var url = "<%=basePath%>company/delete.do?id="+id+"&tm="+new Date().getTime();
					$.get(url,function(data){
						if(data=="success"){
							nextPage(${page.currentPage});
						}
					});
				}
			});
		}
		
		</script>

	<script type="text/javascript">
		
		$(function() {
			
			//单选框
			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			
			//日期框
			$('.date-picker').datepicker();
			
		});
		
		
		</script>

</body>
</html>

